package com.tomecode.tools.maven.settings.config;

/**
 * Supported versions of maven
 * 
 * @author Tomas Frastia
 * @see http://www.tomecode.com or
 *      http://code.google.com/p/maven-settings-editor/
 * 
 */
public enum MavenVersion {

	/**
	 * Maven 2.2.1
	 */
	V221("2.2.1"),
	/**
	 * Maven 3.0
	 */
	V30("3.0"),

	UNKNOWN("");

	private final String name;

	MavenVersion(String name) {
		this.name = name;
	}

	public final String getName() {
		return name;
	}

	public final static String[] getValues() {
		String[] newStrings = new String[3];
		newStrings[0] = UNKNOWN.name;
		newStrings[1] = V221.name;
		newStrings[2] = V30.name;
		return newStrings;
	}

	public static final boolean isSupported(String version) {
		if (V221.name.equals(version)) {
			return true;
		} else if (V30.name.equals(version)) {
			return true;
		}
		return false;
	}

	public static MavenVersion parse(String version) {
		if (V221.name.equals(version)) {
			return V221;
		} else if (V30.name.equals(version)) {
			return V30;
		}
		return UNKNOWN;
	}
}
